package com.alibaba.algo.dao.user;

import com.alibaba.algo.cooperation.feign.vo.req.SelectOrgUserEmployeeVO;
import com.alibaba.algo.cooperation.usercomponent.vo.req.user.SelectEmployeeListRequestVO;
import com.alibaba.algo.cooperation.usercomponent.vo.res.user.EmployeeOrgAndPositionResponseVO;
import com.alibaba.algo.cooperation.usercomponent.vo.res.user.SelectEmployeeBaseAndOrgInfoResVO;
import com.alibaba.algo.core.base.BaseMapper;
import com.alibaba.algo.entity.user.SysEmployee;
import com.alibaba.algo.entity.user.SysUser;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 类SysEmployeeMapper.java的实现描述：员工Mapper
 *
 * @author nieganggang 2021-03-12 16:08:17
 */
public interface SysEmployeeMapper extends BaseMapper<SysEmployee> {

    /**
     * 查询总条数
     *
     * @param entity 实体
     * @return 总条数
     */
    Integer countByCustomPara(@Param("obj") SelectEmployeeListRequestVO entity);

    Integer countWithinUserByCustomPara(@Param("obj") SelectEmployeeListRequestVO entity);

    /**
     * 查询总条数
     *
     * @param entity 实体
     * @return 总条数
     */
    Integer countBySelect(@Param("obj") SelectEmployeeListRequestVO entity);
    /**
     * 员工信息分页查询
     *
     * @param entity 实体
     * @param start  分页开始
     * @param end    分页结束
     * @param sort   排序列表
     * @return 人员列表
     */
    List<SelectEmployeeBaseAndOrgInfoResVO> pageByCustomPara(@Param("obj") SelectEmployeeListRequestVO entity, @Param("start") int start, @Param("end") int end,
                                                             @Param("sort") String sort);

    List<SelectEmployeeBaseAndOrgInfoResVO> pageWithinUserByCustomPara(@Param("obj") SelectEmployeeListRequestVO entity, @Param("start") int start, @Param("end") int end,
                                                             @Param("sort") String sort);

    List<SelectEmployeeBaseAndOrgInfoResVO> pageByIds(@Param("obj") SelectEmployeeListRequestVO entity, @Param("start") int start, @Param("end") int end,
                                                             @Param("sort") String sort);
    /**
     * 查询员工关联的组织和岗位列表
     *
     * @param employeeId 员工标识
     * @return 员工关联的组织和岗位列表
     */
    List<EmployeeOrgAndPositionResponseVO> selectOrgAndPositionList(@Param("employeeId") Long employeeId);

    /**
     * 查询当前组织列表下的人员列表, 对人员去重
     *
     * @param orgIdList 组织列表
     * @return 人员列表
     */
    List<SysEmployee> selectEmployeeListByOrgIdList(@Param("orgIdList") List<Long> orgIdList);

    Integer countByEmployeeList(@Param("list") List<SysEmployee> list);

    List<String> listByCodes(List<String> list);

    List<SysEmployee> selectListByCondition(@Param("obj") SelectOrgUserEmployeeVO vo);

    SysEmployee selectEmployeeByEmployeeCode(@Param("employeeCode") String employeeCode);

    List<SysEmployee> selectListByUserAccount(@Param("obj") SelectOrgUserEmployeeVO vo);

    Integer deleteById(@Param("employeeId") Long employeeId);

    /**
     * 查询员工列表，默认查全部
     */
    List<SysEmployee> listByParaDefaultAll(@Param("obj") SysEmployee sysEmployee, @Param("sort") String sort);

    Integer updateByIdWithIsDeleted(@Param("obj") SysEmployee entity);

    List<SysEmployee> listByParaWithIsDeleted(@Param("obj") SysEmployee sysEmployee, @Param("sort") String sort);

    SysEmployee getByIdWithIsDeleted(@Param("id") Long id);
}
